package com.wmx.entity;

import java.util.concurrent.Callable;

/**
 * @author:wmx 2025-03-11 19:03
 * 1、功能:
 * 2、参数{
 * <p>
 * <p>
 * }
 **/
public class MyCallable implements Callable<String> {

    private static int ticket = 50;
    private String lock = "";
    @Override
    public String call()  {
        while (true){

            synchronized (lock){
                if(0>=ticket){
                    break;
                }
                System.out.println("线程名称:"+Thread.currentThread().getName()+"出售电影票剩余:"+ticket);
                ticket--;
            }

        }

        return null;
    }
}
